package com.lcxw.hxzbapi.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lcxw.hxzbapi.dao.mapper.IncomeTotalMapper;
import com.lcxw.hxzbapi.entity.pojo.IncomeTotal;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;

@Component
public class IncomeTotalService {

    @Resource
    IncomeTotalMapper incomeTotalMapper;

    public int insert(IncomeTotal incomeTotal) {
        return incomeTotalMapper.insert(incomeTotal);
    }

    public int update(IncomeTotal incomeTotal) {
        return incomeTotalMapper.updateById(incomeTotal);
    }

    public IncomeTotal selectByUserId(long userId) {
        QueryWrapper<IncomeTotal> wrapper = new QueryWrapper<>();
        wrapper.eq("userId", userId);
        return incomeTotalMapper.selectOne(wrapper);
    }


}
